﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MShop.Core.Domain.Product>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphMeta" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {


            /***** 选项卡 ****/
            var $li = $(".tabMn li");
            $(".tabMn li").click(function () {

                $(this).addClass("active")
	  .siblings().removeClass("active");
                var index = $li.index($(this));
                $(".tabBox").eq(index).show().siblings().hide();
            }).hover(function () {

                $(this).addClass("hover").siblings().removeClass("hover")
            }, function () { $(this).removeClass("hover"); });

        })

    </script>
    <script type="text/javascript">

        function setSku(skuid) {
            var as0 = skuid.split(':');
            var v = document.getElementById("skuid").value;
            var array = v.split(';');
            var i = 0;
            for (var k in array) {
                var as1 = array[k].split(':');
                if (as1[0] == as0[0]) {
                    break;
                }
                i++;
            }
            array.splice(i, 1, skuid);
            document.getElementById("skuid").value = array.join(";");

        }

        function Increase() {
            document.getElementById('quanitiy').value = parseInt(document.getElementById('quanitiy').value) + 1;
            $('#scount').text(document.getElementById('quanitiy').value);
            $('#stotal').text((document.getElementById('quanitiy').value * <%=Model.ShopPrice %>).toFixed(2));
        }

        function Decrease() {
            var value = parseInt(document.getElementById('quanitiy').value) - 1;
            if (value <= 0) {
                document.getElementById('quanitiy').value = 1;
            }
            else {
                document.getElementById('quanitiy').value = value;
            }
            $('#scount').text(document.getElementById('quanitiy').value);
            $('#stotal').text((document.getElementById('quanitiy').value * <%=Model.ShopPrice %>).toFixed(2));
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% using (Html.BeginForm())
       { %>
    <div id="content" class="ovfl">
        <div id="left" class="side fl">
            <div class="s_box sb_1">
                <h2 class="colorFF0000">
                    一口价商品推荐</h2>
                <div class="sp_tj">
                    <%=Html.Action("RecommendProduct") %>
                </div>
            </div>
            <div class="fl">
                <div class="s_box sb_1">
                    <h2 class="colorFF0000">
                        热卖商品</h2>
                    <div class="sp_tj">
                        <%=Html.Action("TopProduct")%>
                    </div>
                </div>
            </div>
        </div>
        <div id="right" class="main fr">
            <div class="showImg ovfl">
                <div class="prdImg fl">
                    <img src="<%=Model.ImageUrl %>" alt="<%=Model.ProductName%>" />
                </div>
                <div class="prdInfo fl">
                    <ul>
                        <li>
                            <h2 class="nowPrice">
                                <%=Model.ProductName%></h2>
                        </li>
                        <li><span class="color2">商城价：￥<%=Model.ShopPrice %></span></li>
                        <li><del>市场价：￥<%=Model.Price %></del></li>
                        <li>您的价格：<span class="nowPrice">￥<%=Model.ShopPrice %></span></li>
                        <%=Html.Partial("product/DisplaykeyPropControl", Model)%>
                        <%=Html.Partial("product/DisplayitemPropControl", Model)%>
                        <%=Html.Partial("product/DisplaysalePropControl", Model)%>
                        <li>货号：<%=Model.Id %></li>
                        <li>
                            <h3>
                                积分：<%=Model.Points %>(<a>积分帮助</a>)</h3>
                            <div>
                                <p>
                                    买过此产品的10位购买者 综合评分
                                    <img src="/images/xxing2.gif" alt="" />
                                    <img src="/images/xxing2.gif" alt="" />
                                    <img src="/images/xxing2.gif" alt="" />
                                </p>
                                <p>
                                    我要买 <a href="#" onclick="Decrease();">
                                        <img src="/images/cart_icon1.gif" /></a>
                                    <input value="1" maxlength="3" style="width: 22px;" onpaste="return false;" onkeyup="value=value.replace(/[^0-9_]/g,'')"
                                        name="quanitiy" type="text" id="quanitiy" class="txt" />
                                    <a href="#" onclick="Increase();">
                                        <img src="/images/cart_icon2.gif" /></a> 件</p>
                                <p>
                                    总价：
                                    <%=Model.ShopPrice %>
                                    *<span id="scount">1</span>=<span id="stotal"><%=Model.ShopPrice %></span>
                                </p>
                                <p class="btn">
                                    <input type="image" src="/images/buy.gif" alt="购买商品" class="buy" />
                                    <img src="/images/fav.gif" alt="" />
                                </p>
                                <%=Html.Partial("sharedblog") %>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="tabWarp">
                <ul class="tabMn">
                    <li class="active">商品信息</li>
                    <li>售后服务</li>
                    <li>包装清单</li>
                    <li>规格参数</li>
                </ul>
                <div class="tabContent">
                    <div class="tabBox show">
                        <%=Model.Desc %>
                    </div>
                    <div class="tabBox">
                        <%=Model.Warranty %>
                        <div>
                            <strong><font color="#cc3300">声明:</font></strong>因厂家会在没有任何提前通知的情况下更改产品包装、产地或者一些附件，本司不能确保客户收到的货物与商城图片、产地、附件说明完全一致。只能确保为原厂正货！并且保证与当时市场上同样主流新品一致。若本商城没有及时更新，请大家谅解！
                        </div>
                    </div>
                    <div class="tabBox">
                        <%=Model.Package %>
                        <div>
                            <strong><font color="#cc3300">声明:</font></strong>因厂家会在没有任何提前通知的情况下更改产品包装、产地或者一些附件，本司不能确保客户收到的货物与商城图片、产地、附件说明完全一致。只能确保为原厂正货！并且保证与当时市场上同样主流新品一致。若本商城没有及时更新，请大家谅解！
                        </div>
                    </div>
                    <div class="tabBox">
                        <%=Model.Specification %>
                        <div>
                            <strong><font color="#cc3300">声明:</font></strong>因厂家会在没有任何提前通知的情况下更改产品包装、产地或者一些附件，本司不能确保客户收到的货物与商城图片、产地、附件说明完全一致。只能确保为原厂正货！并且保证与当时市场上同样主流新品一致。若本商城没有及时更新，请大家谅解！
                        </div>
                    </div>
                </div>
            </div>
            <div class="comment">
                <h2>
                    最近的商品咨询
                </h2>
                <div>
                </div>
            </div>
        </div>
    </div>
    <%
        StringBuilder sb = new StringBuilder();
        foreach (var item in Model.ItemCat.ItemCatProp)
        {
            if (item.ItemProp.IsSaleProp)
            {

                if (item.ItemProp.IsEnumProp)
                {
                    ItemProp obj = item.ItemProp;
                    var values = Model.ProductSkuProp.Where(x => x.ItemPropId == item.ItemPropId && x.ProductId == Model.Id && x.ItemCatPropId == item.Id)
                        .Select(x => x.PropValue);
                    int i = 0;
                    foreach (var s in values)
                    {
                        if (i == 0)
                        {
                            sb.Append(item.ItemProp.Id);
                            sb.Append(":");
                            sb.Append(s);
                            sb.Append(";");
                        }
                        i++;
                    }
                }
            }
        }
        Response.Write(Html.Hidden("skuid", sb.ToString()));
    %>
    <%} %>
</asp:Content>
